import Vue from 'vue'
import VueRouter from 'vue-router'
// import { component } from 'vue/types/umd'
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Profile from '@/views/Profile'
import Qa from '@/views/Qa'
import Video from '@/views/Video'
import Search from '@/views/Search'
// import { component } from 'vue/types/umd'
import Detail from '@/views/Detail'
import User from '@/views/User/index.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    children: [{ // 固定在底部
      // path: '/home',原本写的
      path: '', // 如何设置默认子路由
      component: Home
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/profile',
      component: Profile
    }, {
      path: '/qa',
      component: Qa
    }, {
      path: '/video',
      component: Video
    }
    ]
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/detail/:artId',
    component: Detail,
    props: true
  },
  {
    path: '/user',
    component: User
  }

]

const router = new VueRouter({
  routes
})

export default router
